Carbon


FSpCreate

Header: Files.h Carbon status: Supported

Creates a new file.

OSErr FSpCreate (
    const FSSpec *spec, 
    OSType creator, 
    OSType fileType, 
    ScriptCode scriptTag
);
spec

A pointer to an FSSpec structure specifying the file to be created.

creator

The creator of the new file.

fileType

The file type of the new file.

scriptTag

The code of the script system in which the filename is to be displayed. If you have established the name and location of the new file using either the StandardPutFile or CustomPutFile procedure, specify the script code returned in the reply structure. Otherwise, specify the system script by setting the scriptTag parameter to the value smSystemScript.

function result

A result code.

DISCUSSION

The FSpCreate function creates a new file (both forks) with the specified type, creator, and script code. The new file is unlocked and empty. The date and time of creation and last modification are set to the current date and time.

Files created using FSpCreate are not automatically opened. If you want to write data to the new file, you must first open the file using a file access function (such as FSpOpenDF).

The resource fork of the new file exists but is empty. You’ll need to call one of the Resource Manager procedures CreateResFile, HCreateResFile, or FSpCreateResFile to create a resource map in the file before you can open it (by calling one of the Resource Manager functions OpenResFile, HOpenResFile, or FSpOpenResFile).

AVAILABILITY

Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.


© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)